<html>
<head><meta charset="utf-8"><title>Spec for rmeta format · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html">Spec for rmeta format</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="237823847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237823847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> weltling <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237823847">(May 07 2021 at 13:38)</a>:</h4>
<p>Hi,</p>
<p>I was looking for some tooling to work  with the rlib/dylib meta data but there doesn't seem to be any. Furthermore, the <code>rust_metadata</code> crate and other helpers are not available for use outside the core, it seems. I might oversee something, what are today the tools to research on the Rust artifacts? Excluding objdump and readelf, as they don't seem relevant for rmeta.</p>
<p>Thanks</p>



<a name="237824813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237824813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237824813">(May 07 2021 at 13:44)</a>:</h4>
<p>you can link against <code>rustc_metadata</code> with <code>#![feature(rustc_private)]</code></p>



<a name="237824844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237824844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237824844">(May 07 2021 at 13:44)</a>:</h4>
<p>but the format is completely unspecified and will likely remain like that for the forseeable future</p>



<a name="237825854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237825854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> weltling <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237825854">(May 07 2021 at 13:50)</a>:</h4>
<p>Thanks for checking. I've just tried to <code>cargo new</code> a crate and put there</p>
<div class="codehilite"><pre><span></span><code>extern crate rustc_metadata;


fn main() {
    println!(&quot;Hello, world!&quot;);
}
</code></pre></div>
<p>but it tells</p>
<p><code>error[E0463]: can't find crate for </code>rustc_metadata`</p>
<p>Still seems not possible to use outside core. Or what i miss?</p>
<p>Thanks!</p>



<a name="237825888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237825888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237825888">(May 07 2021 at 13:50)</a>:</h4>
<p>you need to add the rustc-dev component, iirc</p>



<a name="237825897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237825897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237825897">(May 07 2021 at 13:50)</a>:</h4>
<p>or rust-dev? not sure</p>



<a name="237825907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237825907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237825907">(May 07 2021 at 13:51)</a>:</h4>
<p>I think it's rustc</p>



<a name="237826610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237826610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> weltling <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237826610">(May 07 2021 at 13:55)</a>:</h4>
<p><code>rustc-dev</code> it is and have to be on nightly. I've got a toy to play now, thanks!</p>



<a name="237826931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237826931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237826931">(May 07 2021 at 13:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format/near/237825897">said</a>:</p>
<blockquote>
<p>or rust-dev? not sure</p>
</blockquote>
<p>rust-dev is llvm</p>



<a name="237826958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237826958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237826958">(May 07 2021 at 13:57)</a>:</h4>
<p>/me grumbles about how he warned <span class="user-mention silent" data-user-id="121055">Pietro Albini</span> and <span class="user-mention silent" data-user-id="116122">simulacrum</span> it would be confusing</p>



<a name="237827084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237827084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> weltling <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237827084">(May 07 2021 at 13:58)</a>:</h4>
<p>One more question perhaps, if permitted. Why it is unlikely to be specified? There are more or less universal formats around that can be used without much burden (eg DWARF). Nevertheless, having the specific crate even from nightly seems better for the start at least than writing some parser from stratch :)</p>
<p>Thanks</p>



<a name="237827396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237827396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237827396">(May 07 2021 at 14:00)</a>:</h4>
<p>specifying the format means we  can't change it</p>



<a name="237827588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237827588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237827588">(May 07 2021 at 14:01)</a>:</h4>
<p>DWARF stores very different information than rmeta</p>



<a name="237827738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237827738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237827738">(May 07 2021 at 14:02)</a>:</h4>
<p>DWARF is meant as a common format used by compilers and debugging tools, so there isn't really any way around specifying it</p>



<a name="237828503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237828503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> weltling <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237828503">(May 07 2021 at 14:07)</a>:</h4>
<p>Yeah, it's only to give an example. In most case it's about 'field=value` or a table, etc., no? It's not something like an growable virtual drive image format that needs a very complex implementation, thread safety and so on. Maybe i see it wrong, but the current interfaces are more or less stable. And also, there's such a thing like a versioning .</p>
<p>Thanks</p>



<a name="237828881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237828881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237828881">(May 07 2021 at 14:09)</a>:</h4>
<p>I don't think the format is currently that simply</p>



<a name="237829788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237829788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> weltling <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237829788">(May 07 2021 at 14:15)</a>:</h4>
<p>ACK, thanks a lot for the pointers, at least it is possible to play and discover it.</p>



<a name="237868700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237868700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237868700">(May 07 2021 at 18:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format/near/237827396">said</a>:</p>
<blockquote>
<p>specifying the format means we  can't change it</p>
</blockquote>
<p>No, it just means that you have to bump the version when you do</p>



<a name="237868765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237868765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237868765">(May 07 2021 at 18:25)</a>:</h4>
<p>which is probably a good thing to do anyway if you want compatibility across multiple versions</p>



<a name="237868988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Spec%20for%20rmeta%20format/near/237868988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Spec.20for.20rmeta.20format.html#237868988">(May 07 2021 at 18:26)</a>:</h4>
<p>I don't think it's a contradiction to have a format which is well specified but changes frequently with short notice</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>